home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
gnu
/
libg_261.zip
/
libg_261
/
libg++
/
tests
/
tList.exp
< prev
next >
Wrap
Text File
|
1992-05-06
|
1KB
|
40 lines
intList a = sequence(1, 20);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
intList b = randseq(20);
28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6
intList c = concat(a, b);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6
intList d = map(inc, a);
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
intList e = reverse(a);
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
intList f = select(is_odd, a);
1 3 5 7 9 11 13 15 17 19
int red = a.reduce(plus, 0);
210
int second = a[2];
3
intList g = combine(plus, a, b);
29 29 8 21 49 12 16 48 24 36 60 47 28 62 28 43 42 43 28 26
g.del(is_odd);
8 12 16 48 24 36 60 28 62 28 42 28 26
b.sort(int_compare);
5 6 6 9 9 13 15 15 17 25 25 26 27 27 28 35 40 44 48 49
intList h = merge(a, b, int_compare);
1 2 3 4 5 5 6 6 6 7 8 9 9 9 10 11 12 13 13 14 15 15 15 16 17 17 18 19 20 25 25 26 27 27 28 35 40 44 48 49
h via Pix:
1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 19, 20, 25, 25, 26, 27, 27, 28, 35, 40, 44, 48, 49,
done